<!DOCTYPE html>
<html lang="en" xmlns:th="http://thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>书籍展示</title>
    <!--BootStrap美化界面-->
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>书籍列表 ———— 显示所有书籍</small>
                </h1>
            </div>
        </div>
    </div>
    <div class="row clearfix">
        <div class="col-md-12 column">
            <table class="table table-hover table-striped">
                <thead>
                <div class="col-md-4 column">
                <a class="btn btn-sm btn-success" th:href="@{addPage}">添加</a>
                <a class="btn btn-sm btn-success" th:href="@{listAll}">显示所有书籍</a>
                </div>
                <div class="col-md-4 column">
                    <span style="color: red" th:text="${error}"></span>
                </div>
                <form class="form-inline" th:action="@{query}" method="post" style="float: right">
                <div class="col-md-3 column">
                        <input type="text" name="queryName" class="form-control" placeholder="输入查询的书籍名">
                </div>
                <div class="col-md-1 column">
                    <input type="submit" value="查询" class="btn btn-info">
                </div>
                </form>
                    <tr>
                        <th>书籍编号</th>
                        <th>书籍名称</th>
                        <th>书籍数量</th>
                        <th>书籍描述</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <!--书籍从数据库中查询出来的，从这个books中遍历出来-->
                <tbody>
                    <tr th:each="book:${list}">
                        <td th:text="${book.getBookid()}"></td>
                        <td th:text="${book.getBookname()}"></td>
                        <td th:text="${book.getBookcounts()}"></td>
                        <td th:text="${book.getDetail()}"></td>
                        <td>
                            <a class="btn btn-sm btn-primary" th:href="@{updatePage/}+${book.getBookid()}">编辑</a>
                            <!--空格-->
                            &nbsp; | &nbsp;
                            <a class="btn btn-sm btn-danger" th:href="@{delete/}+${book.getBookid()}">删除</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>
</body>
</html>